<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ page import="java.sql.*;"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	String num = request.getParameter("num");
	String name = request.getParameter("name");
	String author = request.getParameter("author");
	String publisher = request.getParameter("publisher");
	String revision = request.getParameter("revision");
	String price = request.getParameter("price");
	String time = request.getParameter("time");
	try {
		Class.forName("com.mysql.jdbc.Driver");
	} catch (ClassNotFoundException e) {
		out.print(e);
	}

	Connection con;
	Statement sql;

	String url = "jdbc:mysql://localhost:3306/bookinfo?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull";
	String user = "root";
	String psword = "chuichuiqqt";

	try { 
		con=DriverManager.getConnection(url,user,psword);
        sql=con.createStatement();
	    sql.execute("update book set name='"+name+"', author='" + author + "', publisher='" + publisher + "', revision='" + revision + "',price='" + price + "' where num='" + num + "'");
%>
    	<div class="jumbotron">
    		<h3>更新编号为 《<%=num%>》 的书籍成功～！</h3>
    	</div>
<%
	} catch (SQLException e) {
		out.print(e);
%>
		<div class="jumbotron">
    		<h3>更新编号为 《<%=num%>》 的书籍失败～！</h3>
    	</div>
<%
	}
%>